$(function () {
    findCuisineAll();
});

function findCuisineAll() {
    $.ajax({
        url: '/cuisine/findAll',
        data: {},
        type: 'get',
        async: false,
        dataType: 'json',
        success: function (res) {
            console.log(res);
            setCuisineData(res.data);
        }
    })
}

function setCuisineData(data) {
    layui.use(['laydate', 'form', 'layer'],
        function () {
            $ = layui.jquery;
            var form = layui.form;
            let html = '';
            for (let i = 0; i < data.length; i++) {
                // html += ' <div id="cuisine' + data[i].id + '" onclick="cuisineChange(' + data[i].id + ')">' + data[i].name + '</div>';
                html += ' <div  onclick="cuisineChange(' + data[i].id + ',this)">' + data[i].name + '</div>';
            }
            $("#cuisine").html(html);
            form.render();
        })

}

